﻿@model IPagedList<Infinity.Models.Branch>

@{
    ViewBag.Title = "Index";
    Layout = "~/Areas/Managerial/Views/Shared/_AdminLayout.cshtml";
}
@using PagedList;
@using PagedList.Mvc;
<script src="~/Scripts/jquery-1.8.2.min.js"></script>
<script src="~/Scripts/jquery.unobtrusive-ajax.min.js"></script>

<h2>Index</h2>

<p>
    @Html.ActionLink("Create New", "Create")
</p>
<p>   
     @using (Html.BeginForm("Index","Branche",FormMethod.Get ))
     {                                                                           
    <b>Seaech By:</b> @Html.RadioButton("searchBy","Branch Name",true) <text>Branch Name</text>
         @Html.RadioButton("searchBy","Branch Address") <text>Branch Address</text>
         
    <br />
    @Html.TextBox("search") <input type="submit" value="Search" />
     }
 

                      

</p>
<div id="branchdata">
<table>
    <tr>
        <th>
            @Html.DisplayNameFor(model => model.First().BranchID)
        </th>
         <th>
            @Html.DisplayNameFor(model => model.First().Branch_name)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.First().Address)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.First().Telephone)
        </th>
       
        <th></th>
    </tr>

@foreach (var item in Model) {
    using (Html.BeginForm("Delete","Branche",new { id = item.BranchID }))
    {
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.BranchID)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Branch_name)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Address)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Telephone)
        </td>
        
        <td>
            @Html.ActionLink("Edit", "Edit", new { id = item.BranchID }, new { @class="buttonstyle"}) |
          
@*            @Html.ActionLink("Delete", "Delete", new { id=item.BranchID }, new { @class="buttonstyle"})*@
              <input type="submit" value="Delete" class="buttonstyle" onclick="return confirm('Are you sure you  want to delete This')"; />

        </td>
    </tr>
    }
}

</table>
     <table>
        <tr>
            <td>    @Html.PagedListPager(Model, page => Url.Action("Index", new { page, searchBy = Request.QueryString["searchBy"], search = Request.QueryString["search"] }))</td>
            
            <td>&nbsp;&nbsp; @Html.ActionLink("Create New Branch", "Create",null, new { @class="buttonstyle"})</td>
        </tr>
    </table>

    </div>
